<{extends file="$elementPath/layout/index.html"}>
<{block name='body'}>

<form class="layui-form layui-form-pane" action="">
    <div class="layui-form" id="layuiadmin-app-form-list"
         style="padding: 30px ;">
        <div class="layui-form-item">
            <label class="layui-form-label">旧密码</label>
            <div class="layui-input-inline">
                <input type="password" name="old_password"  lay-verify="required" placeholder="请输入当前登陆的密码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">新密码</label>
            <div class="layui-input-inline">
                <input type="password" name="new_password" placeholder="请输入将要设置的新密码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">确认新密码</label>
            <div class="layui-input-inline">
                <input type="password" name="confirm_password"  lay-verify="required" placeholder="重复输入新密码" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item layui-hide">
            <input type="button" lay-submit lay-filter="role-form-submit" id="role-form-submit"
                   value="确认">
        </div>
    </div>
</form>
<script type="text/javascript">
    layui.use(['index', 'form'], function () {
        var $ = layui.$
            , form = layui.form;

        //监听提交
        form.on('submit(role-form-submit)', function (data) {
            var field = data.field; //获取提交的字段
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引

            //提交 Ajax 成功后，关闭当前弹层并重载表格
            //$.ajax({});
            $.post('/<{$module}>/<{$controller}>/<{$action}>?isajax=1&',field,function (res) {
                if (res.code == 0){
                    //ok
                    parent.layer.close(index); //再执行关闭
                } else{
                    layer.msg(res.msg);
                }
            },'json')
        });
    })
</script>

<{/block}>